from django.urls import re_path
from rest_framework.urlpatterns import format_suffix_patterns

from oa.apps import OaConfig

from .views_api import *


API_TITLE = 'API Documents'
API_DESCRIPTION = 'API Information'

app_name = OaConfig.name


urlpatterns = format_suffix_patterns([
    # Login
    re_path(r'^login/account$', LoginAccountView.as_view(), name='account'),
    re_path(r'^login/captcha$', LoginCaptchaView.as_view(), name='captcha'),
    re_path(r'^current_user$', CurrentUserView.as_view(), name='current_user'),
    # Wx
    re_path(r'^wx_login/$', WxLoginView.as_view(), name='wx_login'),
    re_path(r'^wx_login_gzh/$', WxGzhLoginView.as_view(), name='wx_login_gzh'),
    re_path(r'^token/$', AppTokenObtainPairView.as_view(), name='token_obtain_pair'),
    # Staff
    re_path(r'^staffs/$', StaffListView.as_view(), name='staffs'),
    re_path(r'^staffs/(?P<pk>[0-9]+)/$', StaffAppRetrieveUpdateAPIView.as_view(), name='staff'),
    # Products
    re_path(r'^products/$', ProductListView.as_view(), name='products'),
    re_path(r'^product_batches/$', ProductBatchListView.as_view(), name='product_batches'),
    re_path(r'^batch_cost/(?P<pk>[0-9]+)/$', ProductBatchCostView.as_view(), name='batch_cost'),
    # Material
    re_path(r'^public_materials/$', MaterialPublicListView.as_view(), name='public_materials'),
])
